<template>
  <div class="home-swiper">
        <van-search
      v-model="search"
      placeholder="音乐/视频/电台/用户"
      input-align="center"
      @search="onSearch"
    />
    <van-swipe  class="my-swiper" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in banners" :key="index">
        <van-image :src="item.imageUrl" lazy-load/>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      search: "",
      banners: [],
    };
  },
  created() {
    this.getData();
  },
  methods: {
     onSearch(val) {
      Toast(val);
    },
    getData() {
      this.$request("get", "/banner").then((res) => {
        this.banners = res.banners;
      });
    },
  },
};
</script>
<style scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  text-align: center;
}
.my-swipe img {
  border-radius: 1rem;
  width: 100%;
}
</style>